home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / VBASIC / KEYCHECK.ZIP / KEYCHECK.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-14  |  3.1 KB  |  111 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "KeyCheck"
  5.    ClientHeight    =   5760
  6.    ClientLeft      =   1095
  7.    ClientTop       =   1485
  8.    ClientWidth     =   7365
  9.    Height          =   6165
  10.    KeyPreview      =   -1  'True
  11.    Left            =   1035
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5760
  14.    ScaleWidth      =   7365
  15.    Top             =   1140
  16.    Width           =   7485
  17.    Begin Label Label1 
  18.       Alignment       =   2  'Center
  19.       Height          =   495
  20.       Index           =   0
  21.       Left            =   240
  22.       TabIndex        =   0
  23.       Top             =   480
  24.       Width           =   975
  25.    End
  26. Option Explicit
  27. Sub Form_KeyDown (keycode As Integer, Shift As Integer)
  28.    label1(3) = keycode
  29.    label1(6) = Shift
  30. End Sub
  31. Sub Form_KeyPress (keyascii As Integer)
  32.    label1(5) = keyascii
  33. End Sub
  34. Sub Form_KeyUp (keycode As Integer, Shift As Integer)
  35. label1(4) = keycode
  36. label1(7) = Shift
  37. End Sub
  38. Sub Form_Load ()
  39.    Dim letterWidth As Integer, letterHeight As Integer
  40.    letterWidth = TextWidth("W")
  41.    letterHeight = TextHeight("W")
  42.    loadlabels letterWidth, letterHeight
  43.    Me.Width = 17 * letterWidth
  44.    Me.Height = 12 * letterHeight
  45. End Sub
  46. Sub Form_MouseDown (button As Integer, Shift As Integer, X As Single, Y As Single)
  47. Dim i As Integer
  48. If button And 2 Then
  49.    For i = 3 To 7
  50.       label1(i) = ""
  51.    Next i
  52. End If
  53. End Sub
  54. Sub Form_Paint ()
  55. Dim i As Integer
  56. For i = 3 To 7
  57.    outline label1(i)
  58. Next i
  59. End Sub
  60. Sub Label1_MouseDown (index As Integer, button As Integer, Shift As Integer, X As Single, Y As Single)
  61. Dim i As Integer
  62. If index > 2 Or button = 2 Then
  63.    If button And 2 Then
  64.       For i = 3 To 7
  65.          label1(i) = ""
  66.       Next i
  67.    Else
  68.       label1(index) = ""
  69.    End If
  70. End If
  71. End Sub
  72. Sub loadlabels (lw As Integer, lh As Integer)
  73.    Dim w As Integer, h As Integer, i As Integer
  74.    w = lw * 4
  75.    h = lh * 2
  76.    For i = 0 To 7
  77.       If i Then Load label1(i) '0 already exists
  78.       If i > 2 Then
  79.          label1(i).BorderStyle = 1
  80.          label1(i).BackColor = &H80000005
  81.       Else
  82.          label1(i).BackColor = Me.BackColor
  83.       End If
  84.       label1(i).Width = w
  85.       label1(i).Height = h
  86.       label1(i).Top = (i \ 3) * 1.5 * h + lh
  87.       label1(i).Left = lw + ((i Mod 3) * (w + lw))
  88.       label1(i).Visible = True
  89.    Next i
  90.    label1(0) = "Keydown"
  91.    label1(1) = "Keyup"
  92.    label1(2) = "Keypress"
  93. End Sub
  94. Sub outline (c As Control)
  95.     Dim i As Integer
  96.     Dim ct As Integer, cl As Integer
  97.     Dim cr As Integer, cb As Integer
  98.     If TypeOf c Is Menu Then
  99.         'Don't try this at home,kiddies
  100.     Else
  101.         ct = c.Top - screen.TwipsPerPixelY
  102.         cl = c.Left - screen.TwipsPerPixelX
  103.         cr = c.Left + c.Width
  104.         cb = c.Top + c.Height
  105.         c.Parent.Line (cl, ct)-(cr, ct), &H808080
  106.         c.Parent.Line (cl, ct)-(cl, cb), &H808080
  107.         c.Parent.Line (cl, cb)-(cr, cb), &HFFFFFF
  108.         c.Parent.Line (cr, ct)-(cr, cb), &HFFFFFF
  109.     End If
  110. End Sub
  111.